package com.test.homework.day1.controller;

import com.test.homework.day1.pojo.Bill;
import com.test.homework.day1.pojo.TableData;
import com.test.homework.day1.service.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("table.html")
public class BillController {
    @Autowired
    private BillService billService;

    @RequestMapping(params = "act=data")
    @ResponseBody
        public TableData getAll(){
        List<Bill> billList=billService.getAll();
        TableData tableData=new TableData();
        tableData.setData(billList);
        tableData.setCount(18);
        System.out.println(tableData);
        return tableData;
    }
}
